window.onload = function ()
{

    var ajax = getAjax();

    ajax.open("get","/linkMenue/htmlType",true);

    /**
     * <option value='1'>四川</option> <option value='2'>山东</option>
     */
    ajax.onreadystatechange = function ()
    {
        if (ajax.readyState == 4 && ajax.status == 200)
        {
            //获取到了数据
            var responseText = "<option >请选择</option>"+ajax.responseText;
            var provinceSelect = document.getElementById("province");
            provinceSelect.innerHTML = responseText;
        }
    }
    ajax.send();


}
function getCityByPid()
{
    var city = document.getElementById("city");
    city.innerHTML = "<option>请选择</option>";

    var pid = document.getElementById("province").value;
    if (!parseInt(pid))
    {
        return;
    }

    var ajax = getAjax();

    ajax.open("get","/linkMenue/city/"+pid,true);

    ajax.onreadystatechange = function ()
    {
        if (ajax.readyState == 4 && ajax.status == 200)
        {
            var responseText = ajax.responseText;
            city.innerHTML = responseText;
        }
    }

    ajax.send();
}

function getAjax()
{
    var ajax = null;
    try
    {
        ajax = new XMLHttpRequest();
    }catch (e)
    {
        ajax = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return ajax;
}
